<template>
    <div class="loading" v-show="loading">
        <img :src="imgUrl">
        <p>正在加载中...</p>
    </div>
</template>
<script>
import loadSvg from "@/libs/images/loading.svg"

export default {
    name: 'loading',
    data() {
      return {
          loading: false,
          imgUrl: loadSvg
      }
    },
    created() {
      var that = this;
      this.common.$on('loading', function(data) {
          that.loading = !!data;
      })
    }
}
</script>

<style scoped>
.loading {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
}
.loading p {
  color: #fff;
  font-size: 12px;
  margin-top: 10px;
}
.loading img {
  width: 90px;
  height: 90px;
}
</style>